package com.example.zhengwei.base.touch;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;

/**
 * Created by zhengwei on 2015/10/22.
 */
public class MyChild extends View{
    private static final String TAG = MyChild.class.getSimpleName();
    public MyChild(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        Log.d(TAG, this + "dispatchTouchEvent-->" + TouchEventUtil.getTouchAction(ev.getAction()));
        return super.dispatchTouchEvent(ev);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        Log.d(TAG, this + "onTouchEvent-->" + TouchEventUtil.getTouchAction(event.getAction()));
        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                return true;
            case  MotionEvent.ACTION_MOVE:
                this.setVisibility(View.GONE);
            case MotionEvent.ACTION_UP:
                break;
        }
        return false;
    }
}
